<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<td>所在题库: ${Quests[0].name}</td>
<form action="/questController" method="get">
    <input type="hidden" name="rid" value="${not empty Quests[0].rid?Quests[0].rid:param.rid}"/>
    <input type="text" name="title" placeholder="输入题目标题关键字" />
    <input type="text" name="type" placeholder="输入题目类型关键字" />
    <input type="submit" value="查询" />
</form>
<table border="1" cellspacing="0" width="100%">
    <tr>
        <td>题目编号</td>
        <td>题目标题</td>
        <td>题目类型</td>
        <td>答案id</td>
        <td>创建时间</td>
        <td>操作</td>
    </tr>
    <c:forEach items="${Quests}" var="Quest">
        <tr>
            <td>${Quest.id}</td>
            <td>${Quest.title}</td>
            <td>${Quest.type}</td>
            <td>${Quest.answerId}</td>
            <td>${Quest.createTime}</td>
            <td><a href="javascript:updateQuest(${Quest.id})">修改</a></td>
        </tr>
    </c:forEach>
</table>
<center>
            <input type="button" value="添加" onclick="add(${Quests[0].id})">
  </center>
</body>

<script>
    function add(rid) {
        location.href="/questController/toAddQuest/"+rid;
    }
    function updateQuest(rid) {
        location.href="/questController/updateQuest/"+rid;
    }
</script>
</html>
